﻿using System;
using System.Threading.Tasks;
using DeepZoomPivotConstructor.VisualLib;

namespace RenderEngineInterfaces
{
    /// <summary>
    /// Interface to the render engine. Mark this as
    /// something you want to import if you need access
    /// to it to do some sub-rendering in your render
    /// plugin.
    /// </summary>
    public interface IRenderEngine
    {
        /// <summary>
        /// Use this to start a rendering. If you have multiple sub-renderings
        /// to do, this is the best thing to call as it will allow the CPU to use
        /// all cores when it is doing the rendering.
        /// </summary>
        /// <param name="what">The object that we are to render</param>
        /// <param name="forceAsComposableUnit">No matter what, make this unit a compostable unit that cna be saved as a data-base entry and recalled next run</param>
        /// <param name="asComposableUnitIfNoneWithin">Make this a composable unit only if no sub-image contains a composable unit</param>
        /// <param name="disallowRenderPlugins">Exempt the following set of plug-ins from rendering the object</param>
        /// <returns>A task that will yield the visual when it has been rendered. Will be null only if no plug-in could be found to do the rendering. The Task's result may also eventually be null if something goes wrong with the render.</returns>
        Task<Visual> RenderToFuture(object what,
            Type[] disallowRenderPlugins = null,
            bool forceAsComposableUnit = false,
            bool requestComposableUnit = false);

        /// <summary>
        /// Does the same as above, only waits until the
        /// visual is ready to go. This is just something to
        /// make life simpler if you have only a single thing
        /// to sub-render (i.e. a string that is a file-path
        /// and is converted to something else like a fileinfo).
        /// </summary>
        /// <param name="what">The object that we are to render</param>
        /// <param name="forceAsComposableUnit">No matter what, make this unit a compostable unit that cna be saved as a data-base entry and recalled next run</param>
        /// <param name="asComposableUnitIfNoneWithin">Make this a composable unit only if no sub-image contains a composable unit</param>
        /// <param name="disallowRenderPlugins">Exempt the following set of plug-ins from rendering the object</param>
        /// <returns>A visual of the object rendered. May be null.</returns>
        Visual Render(object what,
            Type[] disallowRenderPlugins = null,
            bool forceAsComposableUnit = false,
            bool requestComposableUnit = false);
    }
}
